Skip to content

Refactor(Best gain): Init best gain out of cuts loop #668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

wjrforcyber
Copy link
Contributor

Related: #667

@costamag costamag self-assigned this May 1, 2025
@costamag
Copy link
Contributor

costamag commented May 1, 2025

Hi @wjrforcyberm, thanks for your effort in improving mockturtle!
Unfortunately, the change in your PR leads to suboptimal performance in the cut_rewriting algorithm with compatibility graphs.

If you run the tests, you'll likely see a failure in quality.cpp at line 128:

Expected: { 0, 20, 80, 49, 160, 79, 195, 131, 506 (0x1fa), 2, 258 (0x102) }
Got:      { 0, 20, 74, 47, 34, 77, 103, 87, 275 (0x113), 2, 202 }

These numbers reflect node reductions in the MIG. The reason is that best_gain tracks the best replacement per cut at a given root. Your change skips cuts that could be valid just because they don't beat the best gain from a different root, which breaks the intended behavior.

Let me know if this makes sense, if you can reproduce the failure, and if we can go ahead and close the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants